
<style params.type="text/css">
    table tbody td{
        text-align: center;
    }
</style>

    <table class="table table-hover table-bordered table-striped table-condensed">
        <thead>
        <tr>
            <th>项目名称</th>
            <th>发布公司</th>
            [#if params.qtype == '2']<!--采购询价-->
                [#if params.type == '1']<!--待审核-->
                    <th>发布范围</th>
                    <th>询价产品数</th>
                    <th>已匹配数</th>
                    <th>未匹配数</th>
                [/#if]
                [#if params.type == '2']<!--已审核-->
                    <th>审核结果</th>
                    <th>询价产品数</th>
                    <th>未报价产品数</th>
                [/#if]
                [#if params.type == '3']<!--已截止-->
                    <th>发布范围</th>
                    <th>截止时间</th>
                [/#if]
            [/#if]
            [#if params.qtype == '1']<!--预算询价-->
                <th>需求提供</th>
                [#if params.type == '1' || params.type == '3']<!--待审核-->
                    <th>是否有清单</th>
                [/#if]
                [#if params.type =='2']<!--已审核-->
                    <th>审核结果</th>
                [/#if]
                [#if params.type == '3']<!--已截止-->
                    <th>参与报价</th>
                [/#if]
            [/#if]
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
            [#list pagination.list as enquiry]
            <tr>
                <td>${enquiry.projectName!}</td>
                <td>${enquiry.companyName!}</td>
                [#if params.qtype == '2']<!--采购询价-->
                    [#if params.type =='1']<!--待审核-->
                        <td>[#if enquiry.pubtype??]${(enquiry.pubtype == 1)?string('公开发布' , '不公开发布')}[/#if]</td>
                        <td>[#if !enquiry.items?? || enquiry.items == 0]/[#else]${enquiry.items!0}种[/#if]</td>
                        <td>[#if !enquiry.items?? || enquiry.items == 0]/[#else]${enquiry.itemsNotNUll!0}种[/#if]</td>
                        <td>[#if !enquiry.items?? || enquiry.items == 0]/[#else]${enquiry.items - enquiry.itemsNotNUll}种[/#if]</td>
                    [/#if]
                    [#if params.type == '2']<!--已审核-->
                        <td [#if enquiry.state >1 && enquiry.state < 4]style="color:red;"[/#if]>[#if enquiry.state??][#if enquiry.state >1 && enquiry.state < 4]审核未通过[#else]已通过[/#if][#else]未知[/#if]</td>
                        <td>[#if !enquiry.items?? || enquiry.items == 0]/[#else]${enquiry.items!0}种[/#if]</td>
                        <td>${enquiry.noQuoteItem!0}种</td>
                    [/#if]
                    [#if params.type == '3']<!--已截止-->
                        <td>[#if enquiry.pubtype??]${(enquiry.pubtype == 1)?string('公开发布' , '不公开发布')}[/#if]</td>
                        <td>[#if enquiry.deadline??]${enquiry.deadline?string('yyyy-MM-dd HH:mm:ss')}[/#if]</td>
                    [/#if]
                [/#if]
                [#if params.qtype == '1']<!--预算询价-->
                        <td>${enquiry.needFiles!}</td>
                    [#if params.type == '1' || params.type == '3']<!--待审核-->
                        <td>[#if enquiry.excelpath?? && enquiry.excelpath != '']有清单[#else]无清单[/#if]</td>
                    [/#if]
                    [#if params.type == '2']<!--已审核-->
                        <td [#if enquiry.state >1 && enquiry.state < 4]style="color:red;"[/#if]>[#if enquiry.state??][#if enquiry.state >1 && enquiry.state < 4]审核未通过[#else]已通过[/#if][#else]未知[/#if]</td>
                    [/#if]
                    [#if params.type == '3']<!--已截止-->
                        <td>${quoteCount!0}家</td>
                    [/#if]
                [/#if]
                <td><a href="/enq/v_new_enquiry_detail.do?enquiryId=${enquiry.id!}" target="_blank">查看详情</a></td>
            </tr>
            [/#list]
        </tbody>
    </table>
    <div class="panel-footer">
        [#assign p = pagination]
        [#if p??]
            <button onclick="[#if !p.firstPage]go(1);[#else]javascript:void(0);[/#if]" type="button" class="btn btn-info btn-xs">
                <span class="glyphicon glyphicon-step-backward"></span>
            </button>
            <button onclick="[#if !p.firstPage]go(${p.prePage})[#else]javascript:void(0);[/#if]" type="button" class="btn btn-info btn-xs">
                <span class="glyphicon glyphicon-chevron-left"></span>
            </button>
            &nbsp;${p.pageNo}&nbsp;/&nbsp;${p.totalPage}&nbsp;
            <button onclick="[#if !p.lastPage]go(${p.nextPage})[#else]javascript:void(0);[/#if]" type="button" class="btn btn-info btn-xs">
                <span class="glyphicon glyphicon-chevron-right"></span>
            </button>
            <button onclick="[#if !p.lastPage]go(${p.totalPage})[#else]javascript:void(0);[/#if]" type="button" class="btn btn-info btn-xs">
                <span class="glyphicon glyphicon-step-forward"></span>
            </button>
            &nbsp;&nbsp;&nbsp;
            <button onclick="refresh()" type="button" class="btn btn-info btn-xs">
                <span class="glyphicon glyphicon-refresh"></span>
            </button>
        [/#if]
    </div>

    <form id="dataSearch_${params.qtype}_${params.type}">
        <input type="hidden" name="qtype" value="${params.qtype}" id="qtype"/>
        <input type="hidden" name="type" value="${params.type}" id="type"/>
        <input type="hidden" name="pageNo" value="${p.pageNo!}" id="pageNo"/>
        <input type="hidden" name="noMatch" value="${params.noMatch!}" id="noMatch"/>
        <input type="hidden" name="state" value="${params.state!}" id="state"/>
        <input type="hidden" name="noOffer" value="${params.noOffer!}" id="noOffer"/>
        <input type="hidden" name="noOrder" value="${params.noOrder!}" id="noOrder"/>
        <input type="hidden" name="hasList" value="${params.hasList!}" id="hasList"/>
    </form>

    <script type="text/javascript" >
        $(function(){
            [#if params.qtype == '2' && params.type == '2']
                $("#stateSel").show();
                $('#selectState').unbind("change");
                $("#selectState").on('change' , function(){
                    if($(this).val()){
                        $("#dataSearch_${params.qtype}_${params.type} input[name='state']").val($(this).val());
                        go(1);
                    }
                });
            [#else]
                $("#stateSel").hide();
            [/#if]
            $("#oneBut").html("[#if params.qtype == '1']有清单[#else][#if params.type == '1']未匹配[#elseif params.type == '2']未完全报价[/#if][/#if]（${tipsNum!0}）");

            $('#oneBut').unbind("click");
            $("#oneBut").on('click' , function(){
                $("#dataSearch_${params.qtype}_${params.type} input[name='"+$(this).attr("_id")+"']").val("1");
                go(1);
                return false;
            });

            [#if params.qtype == '1']
                $("#oneBut").attr("_id" , "hasList");
            [#else]
                [#if params.type == '1']
                        $("#oneBut").attr("_id" , "noMatch");
                    [#elseif params.type == '2']
                        $("#oneBut").attr("_id" , "noOffer");
                    [/#if]
            [/#if]

            [#if params.qtype == '2' && params.type == '3']$("#oneBut").hide()[#else]$("#oneBut").show()[/#if]
        });

        function go(pageNo){

//            var str ="";
//            $("#dataSearch_${params.qtype}_${params.type} input").each(function(){
//                if($(this).val()){
//                    str += ("&"+$(this).attr("id")+"="+$(this).val());
//                }
//            });
            $("#dataSearch_${params.qtype}_${params.type} input[name='pageNo']").val(pageNo);
            $('#tabs').tabs('getSelected').panel('open').panel('refresh' , '/enq/v_new_enquiry_data.do?'+$("#dataSearch_${params.qtype}_${params.type}").serialize());
        }
        function refresh(){
            go(${p.pageNo});
        }
    </script>